import json
from common.baseApi import BaseAPI


class Mp_Order(BaseAPI):

    # 立即购买
    def create_pre(self, headers, in_data):
        resp_data = self.requests_send(headers=headers, data=json.dumps(in_data))
        return resp_data

    # 创建订单
    def create_make(self, headers, in_data):
        resp_data = self.requests_send(headers=headers, data=in_data)
        return resp_data

    # 确认支付（保证金）
    def pay_bond(self, headers, in_data):
        resp_data = self.requests_send(headers=headers, data=in_data)
        return resp_data


if __name__ == '__main__':
    payload = {
        "orderNo": "1990985714440151040",
        "payPassword": "e10adc3949ba59abbe56e057f20f883e"
    }
    headers = {
        "v1_access_token": "eyJhbGciOiJIUzUxMiJ9.eyJ1aWQiOjE5NjM0NzAwMjk5ODMyNzcwNTcsInN1YiI6InVzZXIiLCJyb2xlcyI6WyJCVVlFUiJdLCJlbnRlcnByaXNlSWQiOm51bGwsImlzRW50ZXJwcmlzZUFkbWluIjowLCJleHAiOjI1MTY2Njg3NjgsInV1aWQiOiJ1aEJyWHpRajZPMGFVc05tbUJVdkMiLCJlbnRlcnByaXNlTmFtZSI6bnVsbCwidXNlcm5hbWUiOiJtXzE5OTAwMDAwMDAxIn0.IppKTpvISi1FwQkWDIq-TzoBsEQlUIs0R8dGrjuBxiRqsp6FRiYZwCahO6xCfL3R7CmjujuGgMohs2yT_Zt6KA",
        "device_client_type": "mobile-h5",
        "device_id": "fbababec-d02e-482d-adb4-46eefd31183c"
    }

    res = Mp_Order(env='test', host_type='v2_url').pay_bond(headers, payload)
    print(res)
